package com.weilx959.spt.app.controller;

import com.weilx959.spt.core.HostServicesContext;
import com.weilx959.spt.core.interfaces.Controller;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;

public class HomeViewController implements Controller {
    @FXML
    public GridPane rootPane;

    @FXML
    public ImageView mainImageView;

    @FXML
    public Label authorLabel;

    @FXML
    private void initialize() {
        rootPane.heightProperty().addListener((observable, oldValue, newValue) ->
            mainImageView.setFitHeight(newValue.doubleValue() - 80));
    }

    public Pane getRootPane() {
        return rootPane;
    }

    public void openGitee(ActionEvent event) {
        event.consume();
        HostServicesContext.get().showDocument("https://gitee.com/weilx959/spt");
    }

    public void mailto(ActionEvent event) {
        event.consume();
        HostServicesContext.get().showDocument("mailto:weilx959@foxmail.com");
    }
}
